﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace WFBUS.WFInterface
{
    public class Users
    {
        private WFBASE.UserSec us = new WFBASE.UserSec();
        /// <summary>
        /// 檢查動態口令卡
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="dyPwd"></param>
        /// <returns></returns>
        public string ChkDynamicPwd(string loginName, string dyPwd)
        {
            return us.ChkOTP(loginName, dyPwd);
        }

        /// <summary>
        /// 檢查是否需要口令卡
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns></returns>
        public String NeedDynamicPwd(String loginName)
        {
            return us.IsValidOtp(loginName);
        }

        public bool Login(string loginName, string PWD, out string UID)
        {
            return us.Login(loginName, PWD, out UID);
        }

        public string GetUserInfotByID(string userID)
        {
            return us.GetUserInfotByID(userID);
        }

        public string GetUsers(string factNo, string deptNo, string userName, string loginName)
        {
            return new WFBUS.Privilage.Users().GetUsers(factNo, deptNo, userName, loginName);
        }

        /// <summary>
        /// 啟用停用用戶
        /// </summary>
        /// <param name="p_userId"></param>
        /// <param name="p_action"></param>
        /// <returns></returns>
        public string StopUser(string p_userId, string p_action)
        {
            return new WFBUS.Privilage.Users().StopUser(p_userId, p_action);

        }

        public DataSet GetUserInfo(string p_userid)
        {
            return new WFBUS.Privilage.Users().GetUserInfo(p_userid);
        }
        public string InsUser(string p_factNo, string p_deptNo, string p_userName, string p_loginName, string p_password,
            string p_position, string p_tel, string p_mail, string p_yz_mode, string p_yz_text, string p_yz_text2, string p_yz_text3)
        {
            return new WFBUS.Privilage.Users().InsUser(p_factNo, p_deptNo, p_userName, p_loginName, p_password,
            p_position, p_tel, p_mail, p_yz_mode, p_yz_text, p_yz_text2, p_yz_text3);
        }
        public string UpdUser(string p_userId, string p_factNo, string p_deptNo, string p_userName, string p_loginName, string p_password,
            string p_position, string p_tel, string p_mail, string p_yz_mode, string p_yz_text, string p_yz_text2, string p_yz_text3)
        {
            return new WFBUS.Privilage.Users().UpdUser(p_userId, p_factNo, p_deptNo, p_userName, p_loginName, p_password,
            p_position, p_tel, p_mail, p_yz_mode, p_yz_text, p_yz_text2, p_yz_text3);
        }

    }
}
